package com.sss.hloster04;

import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

public class TestTreeSet02 {

	public static void main(String[] args) {
		// 用有序的TreeSet存储学生对象
		Set stuTS = new TreeSet();
		stuTS.add(new Student("王云", 1));
		stuTS.add(new Student("南天华", 3));
		stuTS.add(new Student("刘景涛", 2));
		stuTS.add(new Student("张平", 3));
		// 使用迭代器循环输出
		Iterator it = stuTS.iterator();
		while (it.hasNext()) {
			System.out.println(it.next());
		}
	}

}
